home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / BlitzBasic / MUI / Developer / BB2 / Examples / ShowHide.asc < prev   
Text File  |  1998-06-24  |  4KB  |  114 lines

  1. ;** The ShowHide demo shows how to hide and show objects.
  2. ;Based on the example ShowHide.c by Stefan Stuntz
  3. ;Adapted in Blitz Basic 2 by Erwan Fouret
  4.  
  5. INCDIR "MUI:Developer/BB2/Include/"
  6. INCLUDE mui.bb2
  7.  
  8. #SIGBREAKF_CTRL_C=(1 LSL 12)
  9.  
  10. NEWTYPE.tags a.l:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:End NEWTYPE
  11.  
  12. DEFTYPE.b *app,*win,*cm1,*cm2,*cm3,*cm4,*cm5,*bt1,*bt2,*bt3,*bt4,*bt5;
  13. DEFTYPE.tags atags,wtags,vgt1,vgt2,hgt1,hgt2
  14.  
  15. *cm1 = CheckMark(MUI_TRUE)
  16. *cm2 = CheckMark(MUI_TRUE)
  17. *cm3 = CheckMark(MUI_TRUE)
  18. *cm4 = CheckMark(MUI_TRUE)
  19. *cm5 = CheckMark(MUI_TRUE)
  20.  
  21. *bt1 = SimpleButton("Button 1")
  22. *bt2 = SimpleButton("Button 2")
  23. *bt3 = SimpleButton("Button 3")
  24. *bt4 = SimpleButton("Button 4")
  25. *bt5 = SimpleButton("Button 5")
  26.  
  27. Dim t$(6),*tp(6)
  28.  
  29. t$(0)="ShowHide"
  30. t$(1)="$VER: ShowHide 19.5 (12.02.97)"
  31. t$(2)=Chr$(167)+"1992/93, Stefan Stuntz"
  32. t$(3)="Stefan Stuntz"
  33. t$(4)="Show object hiding."
  34. t$(5)="SHOWHIDE"
  35. t$(6)="Show & Hide"
  36.  
  37. For i=0 To 6
  38.  t$(i)=t$(i)+Chr$(0)
  39.  *tp(i)=&t$(i)
  40. Next
  41.  
  42. vgt2\a=#Child,*bt1,#Child,*bt2,#Child,*bt3,#Child,*bt4,#Child,*bt5,#Child,MUI_MakeObjectA_(#MUIO_VSpace,0),0
  43.  
  44. hgt2\a=#MUIA_Group_Horiz,MUI_TRUE,#MUIA_Weight,0,#Child,*cm1,#Child,*cm2,#Child,*cm3,#Child,*cm4,#Child,*cm5,0
  45.  
  46. vgt1\a=#MUIA_Frame,#MUIV_Frame_Group,#Child,MUI_NewObjectA_("Group.mui",hgt2)
  47. vgt1\e=#Child,MUI_NewObjectA_("Group.mui",vgt2),0
  48.  
  49. hgt1\a=#MUIA_Group_Horiz,MUI_TRUE,#Child,MUI_NewObjectA_("Group.mui",vgt1),0
  50.  
  51. wtags\a=#MUIA_Window_Title, *tp(6)
  52. wtags\c=#MUIA_Window_ID   , $53484844   ;="SHHD"
  53. wtags\e=#WindowContents, MUI_NewObjectA_("Group.mui",hgt1),0
  54.  
  55. *win=MUI_NewObjectA_("Window.mui",wtags)
  56.  
  57. atags\a=#MUIA_Application_Title      , *tp(0)
  58. atags\c=#MUIA_Application_Version    , *tp(1)
  59. atags\e=#MUIA_Application_Copyright  , *tp(2)
  60. atags\g=#MUIA_Application_Author     , *tp(3)
  61. atags\i=#MUIA_Application_Description, *tp(4)
  62. atags\k=#MUIA_Application_Base       , *tp(5)
  63. atags\m=#SubWindow, *win, 0
  64.  
  65. *app = MUI_NewObjectA_("Application.mui",atags)
  66.  
  67. If *app=0
  68.  End
  69. EndIf
  70.  
  71.  
  72. ;** Install notification events...
  73.  
  74. DoMethod *win,#MUIM_Notify,#MUIA_Window_CloseRequest,MUI_TRUE,*app,2,#MUIM_Application_ReturnID,#MUIV_Application_ReturnID_Quit
  75.  
  76. DoMethod *cm1,#MUIM_Notify,#MUIA_Selected,#MUIV_EveryTime,*bt1,3,#MUIM_Set,#MUIA_ShowMe,#MUIV_TriggerValue
  77. DoMethod *cm2,#MUIM_Notify,#MUIA_Selected,#MUIV_EveryTime,*bt2,3,#MUIM_Set,#MUIA_ShowMe,#MUIV_TriggerValue
  78. DoMethod *cm3,#MUIM_Notify,#MUIA_Selected,#MUIV_EveryTime,*bt3,3,#MUIM_Set,#MUIA_ShowMe,#MUIV_TriggerValue
  79. DoMethod *cm4,#MUIM_Notify,#MUIA_Selected,#MUIV_EveryTime,*bt4,3,#MUIM_Set,#MUIA_ShowMe,#MUIV_TriggerValue
  80. DoMethod *cm5,#MUIM_Notify,#MUIA_Selected,#MUIV_EveryTime,*bt5,3,#MUIM_Set,#MUIA_ShowMe,#MUIV_TriggerValue
  81.  
  82. MUI_set *cm3,#MUIA_Selected,False
  83.  
  84. ;** This is the ideal input loop for an object oriented MUI application.
  85. ;** Everything is encapsulated in classes, no return ids need to be used,
  86. ;** we just check if the program shall terminate.
  87. ;** Note that MUIM_Application_NewInput expects sigs to contain the result
  88. ;** from Wait() (or 0). This makes the input loop significantly faster.
  89.  
  90. MUI_set *win,#MUIA_Window_Open,MUI_TRUE
  91.  
  92.                 sigs.l = 0
  93.  
  94.                 While DoMethod(*app,#MUIM_Application_NewInput,&sigs) <> #MUIV_Application_ReturnID_Quit
  95.  
  96.                         If (sigs)
  97.  
  98.                                 sigs = Wait_(sigs | #SIGBREAKF_CTRL_C)
  99.                                 If (sigs AND #SIGBREAKF_CTRL_C)
  100.                                  Pop While:Goto finish
  101.                                 EndIf
  102.                         EndIf
  103.                 Wend
  104.  
  105. finish:
  106.         MUI_set *win,#MUIA_Window_Open,False
  107.  
  108.  
  109. ;** Shut down...
  110.  
  111. MUI_DisposeObject_ *app
  112.  
  113. End
  114.